﻿using System.Configuration;

namespace TSharp.Core.Mvc.XmlRouting
{
    /// <summary>
    ///     默认参数
    ///     <para>2010/8/13</para>
    ///     <para>TANGJINGBO</para>
    ///     <para>tangjingbo</para>
    /// </summary>
    internal sealed class Parameter : ConfigurationElement
    {
        /// <summary>
        ///     Gets the name.参数名称
        /// </summary>
        /// <value>The name.</value>
        [ConfigurationProperty("name", IsRequired = true, IsKey = true)]
        public string Name
        {
            get { return this["name"].ToString(); }
        }

        /// <summary>
        ///     Gets the value.参数值
        /// </summary>
        /// <value>The value.</value>
        [ConfigurationProperty("value", IsRequired = false)]
        public string Value
        {
            get { return (string)this["value"]; }
        }

        [ConfigurationProperty("optional", IsRequired = false)]
        public bool IsOptional
        {
            get
            {
                return (bool)this["optional"];
            }
        }
        /// <summary>
        ///     Gets the constraint.参数正则限制
        /// </summary>
        /// <value>The constraint.</value>
        [ConfigurationProperty("constraint", IsRequired = false)]
        public string Constraint
        {
            get { return this["constraint"].ToString(); }
        }
    }
}